package com.qiantu.phone.utils;

import android.content.Context;

import com.google.gson.Gson;
import com.google.gson.reflect.TypeToken;
import com.qiantu.phone.bean.WeatherTypeBean;

import java.util.List;

public class WeatherConditionTypeParseUtil {

    private static String jsonDataStr;

    public static List<WeatherTypeBean> parseData(Context context) {
        if(jsonDataStr == null){
            jsonDataStr = new GetJsonDataUtil().getJson(context, "WeatherConditionType.json");//获取assets目录下的json文件数据
        }
        List<WeatherTypeBean> weatherTypeList = new Gson().fromJson(jsonDataStr, new TypeToken<List<WeatherTypeBean>>() {}.getType());
        return weatherTypeList;
    }

    public static void clearData(){
        jsonDataStr = null;
    }
}
